<ul>
<?php
$links = sqlite_fetch_all(sqlite_query($db,"SELECT * FROM links"));
foreach($links as $link) {
  $fromid = $link['fromid'];
  $from = sqlite_fetch_single(sqlite_query($db,"SELECT title FROM pages WHERE id = $fromid"));
  $to = $link['to'];
  echo "<li><a href='?show=$from'>$from</a> -> <a href='?show=$to'>$to</a></li>\n";
}
?>
</ul>